1. Field of the Invention
The present invention relates generally to Automatic Gain Control (AGC) circuits and more specifically pertains to AGC circuits with improved response time and stability.
2. Description of Related Art
AGC circuits are designed to maintain a desired signal level at the output of the circuit. To achieve this goal, the algorithm used by the AGC circuit has to adapt to variations in the input signal of the circuit. Typically, there is a tradeoff between responsiveness and stability of the system. Thus, conventional AGC circuits are either sluggish or become unstable under certain circumstances.
Most AGC algorithms are based on calculation of a long term average energy (E.sub.mean) of the output signal of the AGC circuit, computed over several time frames. The goal of a circuit designer is to maintain, on the output of the circuit, the long term average energy E.sub.mean at, or close to, a target reference energy level (E.sub.ref). This is accomplished in a feedback loop of the AGC circuit where the input signal is multiplied with an updated value of gain estimate (G) until the energy level of the output signal approaches the target reference energy level E.sub.ref.
The gain estimate G of the AGC circuit is varied as a function of a difference .DELTA.=E.sub.ref -E.sub.mean, which is weighted with a proportionality constant. The value of the proportionality constant is one of the factors affecting the responsiveness of the system. Another factor is dependent on the way the long term average energy E.sub.mean is calculated. If the calculation of E.sub.mean involves input signals from many past time frames, the AGC circuit will be slow in incorporating changes in the signal. This may be somewhat desirable, since the AGC circuit should not react too rapidly to short term changes. On the other hand, if the system is too slow with incorporation of the changes, the AGC circuit may not be able to boost or attenuate the input signal in reasonable time. Therefore, the AGC circuit parameters should be chosen carefully to ensure both the stability and responsiveness of the system.
A block diagram of a conventional AGC circuit is presented in FIG. 1. The elements of the block diagram can be presented with following equations, applicable in linear or dB domain: EQU E.sub.mean '=(1-.beta.) E.sub.mean +.beta.R.sub.0 (1) EQU .DELTA.=E.sub.ref -E.sub.mean ' (2) EQU .epsilon.=f(.DELTA.)=.DELTA..gamma..sub.1 +sign(.DELTA.).DELTA..sup.2 .gamma..sub.q (3) EQU G'=G+.epsilon. (4)
where R.sub.0 is energy of a current frame of the input signal, .beta. is an averaging constant, .epsilon. is a gain change, G is an estimated gain, .gamma..sub.1, is a coefficient representing linear slew rate and .gamma..sub.q is a coefficient representing quadratic slew rate. E.sub.mean and G are calculated recursively in the feedback loop. The initial value of G and E.sub.mean is set to zero dB, which is unity gain in linear domain. The gain change .epsilon. is included in Eq. (1) indirectly, as a function of the averaging constant .beta..
FIG. 1 represents the elements of the AGC circuit 10 observed during one frame. An input signal x(n) 12, already converted into digital form, is updated in a feedback loop 16 and exits as an output signal y(n) 13. The energy of the frame R.sub.0 14, corresponding to the input signal x(n) 12, is calculated in a circuit element 14. The value of R.sub.0 14 is used in a circuit element 17 of the feedback loop 16 to calculate a new estimated value of E.sub.mean ' 18 according to Eq. (1). The difference .DELTA.20 is obtained according to Eq. (2), in a summing element 19 which subtracts E.sub.ref 15 from the new estimated value of the E.sub.mean '18. The gain change .epsilon. 22 is obtained according to Eq. (3) in a circuit element 21, and a new value of estimated gain G'24 in a circuit element 23 according to Eq. (4). The output signal y(n) 13, which is a new value of the input signal x(n) 12, is obtained in a multiplying element 26 of the feedback loop 16, which multiplies the new value of the estimated gain G' 24 with the input signal x(n) 12. Each circuit element 14, 17, 21 and 24 can be any conventional circuit able to perform the respective calculation. These circuits are well known in the art.
The new estimate of the long term average energy E.sub.mean ' 18 is calculated in the circuit element 17 and represents the sum of the weighted estimated long term average energy E.sub.mean of the previous frame and the weighted input signal energy R.sub.0. The weighting parameter is the averaging constant .beta., which controls the relative weight of the two terms of Eq. (1) and determines how quickly new frames are incorporated in the long term average energy E.sub.mean calculations. The value of .beta. depends on the circuit and is preferably about 0.1. A large value of .beta.leads to a faster update of E.sub.mean and vice versa. Too large a value of.beta.leads to a very fast update of E.sub.mean, which causes the AGC circuit to quickly react to variations in the input signal, thus leading to distortion. On the other hand, too small a value of .beta. leads to very slow update of E.sub.mean which results in sluggish response.
The gain change .epsilon. is used for adjustment of the estimated gain G. The adjustment may be an increment or a decrement. The gain change .epsilon. is represented with the Eq. (3) which has two terms. The first term is .DELTA..gamma..sub.1 which represents a slew rate of the difference .DELTA. and provides an adjustment based on a linear function. The second term .DELTA..sup.2 .gamma..sub.q is based on a square of the first term. Because too small slew value results in sluggish response and too large a value may lead to oscillations, the coefficients .gamma..sub.1 and .gamma..sub.q should be set such that the quadratic term practically vanishes during small energy variations, when the linear term keeps track of small energy variations. On the other hand, when there is a large or abrupt change in energy, the quadratic term becomes more important because it adjusts the estimated gain G quickly. It also vanishes quickly as the E.sub.mean approaches the target reference energy level E.sub.ref.
In order to analyze a typical situation in a conventional AGC circuit which leads to oscillations, it can be assumed that initially E.sub.mean is not close to E.sub.ref, leading to a large feedback in estimated gain calculation, as presented in Eq. (4). The estimated gain varies quickly in response to such a large feedback. Because E.sub.mean is an average long term energy computed over several frames, the effect of the increased gain will be reflected in E.sub.mean several frames later. In the mean time, the difference .DELTA.=E.sub.ref -E.sub.mean decreases, although slowly. As a result, the gain continues to increase rapidly in order to make E.sub.mean become close to E.sub.ref. By the time the effect of the increased gain value is fully effecting the E.sub.mean, the gain has changed too much.
Essentially, the gain G reacts immediately to changes in E.sub.mean, but the E.sub.mean calculation reacts to changes in gain very gradually. This leads to oscillations in the AGC circuit, as illustrated in FIGS. 2 and 3. It can be seen that in a conventional system the estimating gain curve and the long term average energy E.sub.mean curve have the same general shape of an oscillation curve, and that E.sub.mean curve is lagging the estimated gain curve.
Therefore, there is a need for an AGC circuit with good response time and with good stability.